//
//  GLKTableView.h
//  KTools
//
//  Created by zhiyong.kuang on 2017/9/28.
//  Copyright © 2017年 zhiyong.kuang. All rights reserved.
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                            O\ = /O
//                        ____/`---'\____
//                      .   ' \\| |// `.
//                       / \\||| : |||// \
//                     / _||||| -:- |||||- \
//                       | | \\\ - /// | |
//                     | \_| ''\---/'' | |
//                      \ .-\__ `-` ___/-. /
//                   ___`. .' /--.--\ `. . __
//                ."" '< `.___\_<|>_/___.' >'"".
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |
//                 \ \ `-. \_ __\ /__ _/ .-` / /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//
//         .............................................
//                  佛祖镇楼                  BUG辟易

#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, GLErrorCode) {
    GLErrorCodeNone = 0,
    GLErrorCodeValueNil,
    GLErrorCodeValueValid,
};



#pragma mark- class GLFormError

@interface GLFormError : NSError
@property(nonatomic,copy)NSString* tag;
@end

@class GLFormSection;
@class GLFormRow;

typedef void(^GLFormEventClicked)(GLFormRow*row,id sender,BOOL isSub,NSString* subTag);

@interface GLForm : NSObject
@property(nonatomic,readonly)NSMutableArray* sectioins;
@property(nonatomic,copy)NSString* tag;

@property (nonatomic, strong) UIView *formHeaderView;
@property (nonatomic, strong) UIView *formFooterView;
@property (nonatomic, assign) BOOL showCorner;


@property (nonatomic, strong) GLFormEventClicked formClicked;


+(instancetype)formWithTag:(NSString*)tag;

-(void)addFormSection:(GLFormSection*)section;
-(void)removeFormSectionIndex:(NSInteger)index;


-(NSArray<GLFormRow *> *)formRowsWithTag:(NSString *)tag;
-(GLFormRow *)formRowAtIndex:(NSIndexPath *)indexPath;
-(NSIndexPath *)indexPathForFormRow:(GLFormRow *)formRow;
-(GLFormSection *)formSectionAtIndex:(NSUInteger)index;
-(NSInteger)indexformSection:(GLFormSection*)section;


-(NSDictionary *)formValues;
-(GLFormError*)validateFormValues;

@end





